Exporting Data from Sources Other Than Movies
This section describes new functions provided by movie data export components that allow applications to export data from sources other than movies.
MovieExportAddDataSource
The function allows you to define a data source for use with an export operation performed by
MovieExportFromProceduresToDataRef
.
pascal ComponentResult MovieExportAddDataSource (MovieExportComponent ci, OSType trackType,
TimeScale scale, long *trackID, MovieExportGetPropertyUPP
getPropertyProc, MovieExportGetDataUPP getDataProc, void *refCon)
-
ci
-
Identifies the Movie Toolbox's connection to your component.
-
trackType
-
Specifies the type of media provided by this data source. This will normally correspond to a QuickTime media type such as
VideoMediaType
or
SoundMediaType
.
-
scale
-
Specifies the
TimeScale
for time values passed to
getDataProc
parameter. If the source data is being taken from a QuickTime track, this value will typically be the media's
TimeScale
.
-
trackID
-
Contains an identifier for the data source. This identifier is returned from the call.
-
getPropertyProc
-
Specifies a callback function that provides information about processing source samples.
-
getDataProc
-
Specifies a callback function the export component uses to request sample data.
-
refCon
-
Passed to the procedures specified in the
getPropertyProc
and
getDataProc
parameters.
DISCUSSION
Before starting an export operation, all the data sources must be defined by calling
MovieExportAddDataSource
once for each data source.
RESULT CODES
-
To be provided
-
MovieExportFromProceduresToDataRef
The MovieExportFromProceduresToDataRef function exports data provided by
MovieExportAddDataSource
to a location specified by
dataRef
and
dataRefType
.
pascal ComponentResult MovieExportFromProceduresToDataRef (MovieExportComponent ci, Handle
dataRef, OSType dataRefType)
-
ci
-
Specifies the movie component for the export operation.
-
dataRef
-
Specifies the data reference for the export operation.
-
dataRefType
-
Specifies the type identifier for the data reference specified by
dataRef
.
DISCUSSION
Movie data export components that support export operations from procedures must set the
canMovieExportFromProcedures
flag in their component flags.
Typically
dataRef
contains a Macintosh file alias and
dataRefType
is set to
rAliasType
.
RESULT CODES
-
To be provided
-
MovieExportGetPropertyProcPtr
You use MovieExportGetPropertyProcPtr to return parameters that determine the appropriate format for the output data.
typedef pascal OSErr (*MovieExportGetPropertyProcPtr)(void *refcon, long trackID, OSType
propertyType, void *propertyValue);
-
refCon
-
Contains the value passed to
MovieExportAddDataSource
in the
refCon
parameter.
-
trackID
-
Specifies the value returned from
MovieExportAddDataSource
.
-
propertyValue
-
Contains a pointer to the location of the requested property information.
-
propertyType
-
Specifies the property being requested. All currently defined property types are listed in
Table 11-1
.
Table 1
Currently supported property types
Property
|
Type
|
Track Type
|
scSoundSampleRateType
|
UnsignedFixed
|
sound
|
scSoundSampleSizeType
|
short
|
sound
|
scSoundChannelCountType
|
short
|
sound
|
scSoundCompressionType
|
OSType
|
sound
|
meWidth
|
Fixed
|
video
|
meHeight
|
Fixed
|
video
|
scSpatialSettingsType
|
SCSpatialSettings
|
video
|
scTemporalSettingsType
|
SCTemporalSettings
|
video
|
scDataRateSettingsType
|
SCDataRateSettings
|
video
|
DISCUSSION
The function defined by
MovieExportGetPropertyProcPtr
type is passed to
MovieExportAddDataSource
to define a new data source for an export operation. For example, a video export operation may call the function to determine the dimensions of the destination video track.
If the function doesn't have a setting for a requested property, it should return an error. The export component provides a default value for the property based on the source data format. For example, if no values for video track width and height properties were provided by the callback function, the dimensions of the source data would be used.
RESULT CODES
-
To be provided
-
MovieExportGetDataProcPtr
You use the function defined by
MovieExportGetDataProcPtr
to define a data source for an export operation.
typedef pascal OSErr (*MovieExportGetDataProcPtr)(void *refCon, MovieExportGetDataParams
*params);
The sample request is made through a parameter block. The data structure used is shown below.
struct MovieExportGetDataParams {
long recordSize;
long trackID;
TimeScale sourceTimeScale;
TimeValue requestedTime;
TimeValue actualTime;
Ptr dataPtr;
long dataSize;
SampleDescriptionHandle desc;
OSType descType;
long descSeed;
long requestedSampleCount;
long actualSampleCount;
TimeValue durationPerSample;
long sampleFlags;
};
typedef struct MovieExportGetDataParams MovieExportGetDataParams;
-
refCon
-
Contains the value passed to
MovieExportAddDataSource
in the
refCon
parameter.
-
recordSize
-
Contains the total size in bytes of the
MovieExportGetDataParams
structure. This is provided to allow for additional parameters to be added safely in the future.
-
trackID
-
Specifies the data source. The
trackID
is returned when the data source is added by calling
MovieExportAddDataSource
.
-
sourceTimeScale
-
Specifies the TimeScale for this data source. This value is the same TimeScale that is passed to
MovieExportAddDataSource
.
-
requestedTime
-
Specifies the time of the media requested by the exporter. The
TimeScale
is the same one specified when adding a data source with
MovieExportAddDataSource
.
-
actualTime
-
Specifies the time actually referred to by the returned media data. This value is provided by
MovieExportGetDataProcPtr,
and is usually the same as
requestedTime
.
-
dataPtr
-
Contains a 32-bit pointer to the media data.
-
dataSize
-
Specifies the size in bytes of the data pointed to by
dataPtr.
-
desc
-
Contains a
SampleDescriptionHandle
describing the format of the data pointed to by
dataPtr
. For video data, this is an
ImageDescriptionHandle
. For sound data, this is a
SoundDescriptionHandle
.
-
descType
-
Specifies the type of
SampleDescriptionHandle
. For example, if
SampleDescriptionHandle
is
ImageDescriptionHandle, descType
is set to
VideoMediaType
.
-
descSeed
-
Specifies which
SampleDescriptionHandle
represented by the current value of
desc
. Some data sources contain different kinds of data at different times. For example, a video data source may contain both JPEG and uncompressed raw data. Whenever the data source switches from one type of data to another, change
descSeed
to notify the exporter. In the case of an export operation that is providing its source data from a QuickTime movie track,
descSeed
is equal to the sample description index of the sample being returned.
-
requestedSampleCount
-
Specifies the number of samples the exporter can work with. The function can return more or fewer samples than requested. For video, this value is always 1.
-
actualSampleCount
-
Specifies the number of samples actually returned. The function must fill in this field.
-
durationPerSample
-
Specifies the duration of every sample returned. For sound data,
durationPerSample
always contains 1. For video data,
durationPerSample
contains the duration of the returned sample, expressed in the TimeScale defined when the data source was created.
-
sampleFlags
-
Contains the flags for the returned samples. The only defined flag is
mediaSampleNotSync
, which is usually only returned for frame-differenced video sample data. The function must fill in this field.
DISCUSSION
The function defined by the
MovieExportGetDataProcPtr
type is passed to
MovieExportAddDataSource
to define a new data source for an export operation. The function is used by the exporting application to request source media data to be used in the export operation. For example, in a video export operation, frames of video data (either compressed or uncompressed) are provided. In a sound export operation, buffers of audio (either compressed or uncompressed) are provided.
The data pointed to by
dataPtr
must remain valid until the next call to this
MovieExportGetDataProcPtr
function. The
MovieExportGetDataProcPtr
function is responsible for allocating and disposing of the memory associated with this data pointer.
RESULT CODES
-
To be provided
-
MovieExportToDataRef
MovieExportToDataRef
allows an application to request that data is exported to a data reference, instead of to a file.
pascal ComponentResult MovieExportToDataRef(MovieExportComponent ci, Handle dataRef, OSType
dataRefType, Movie theMovie, Track onlyThisTrack, TimeValue startTime,
TimeValue duration)
-
ci
-
Identifies the Movie Toolbox's connection to your component.
-
dataRef
-
Contains a handle to a data reference indicating where the data should be stored.
-
dataRefType
-
Specifies the type of the data reference. For exporting to a file, the
dataRef
will be a Macintosh file alias and the
dataRefType
will be
rAliasType
.
-
theMovie
-
Identifies the movie for this operation. This movie identifier is supplied by the Movie Toolbox. Your component may use this identifier to obtain sample data from the movie or to obtain information about the movie.
-
onlyThisTrack
-
Identifies a track that is to be converted. This track identifier is supplied by the Movie Toolbox. If this parameter contains a track identifier, your component must convert only the specified track.
-
startTime
-
Specifies the starting point of the track or movie segment to be converted. This time value is expressed in the movie's time coordinate system.
-
duration
-
Specifies the duration of the track or movie segment to be converted. This duration value is expressed in the movie's time coordinate system.
MovieExportGetSettingsAsAtomContainer
The MovieExportGetSettingsAsAtomContainer routine retrieves the current settings from the movie export component.
pascal ComponentResult MovieExportGetSettingsAsAtomContainer ( MovieImportComponent
ci,
QTAtomContainer *settings);
-
ci
-
The movie export component instance.
-
settings
-
The address where the newly-created atom container should be stored by the call.
DISCUSSION
The caller is responsible for disposing of the returned QTAtomContainer.
MovieExportSetSettingsFromAtomContainer
The MovieExportSetSettingsFromAtomContainer routine sets the movie export component's current configuration from the passed settings data.
pascal ComponentResult MovieExportSetSettingsFromAtomContainer (
MovieExportComponent ci,
QTAtomContainer settings);
-
ci
-
The movie import component instance.
-
settings
-
This contains a QTAtomContainer reference to the settings.
DISCUSSION
The settings QTAtomContainer may contain atoms other than those expected by the particular component type or may be missing certain atoms. The function will only use settings it understands.
© 1997 Apple Computer, Inc.| Previous | Chapter contents | Chapter top | Section top | Next |